package abstractBeanFactory.RectBeanFactory;

import java.awt.Color;
import java.awt.Graphics;

import abstractBeanFactory.BaseExplode;
import tank.Audio;
import tank.ResourceMgr;
import tank.TankFrame;

public class RectExplode extends BaseExplode{

	public static final int WIDTH = ResourceMgr.explodes[0].getWidth();
	public static final int HEIGHT = ResourceMgr.explodes[0].getWidth();
	private static final int SPEED =5;
	private int x,y;
	private TankFrame tf = null;
	private boolean living = true;
	private int step =0;
	public RectExplode(int x, int y, TankFrame tf) {
		super();
		this.x = x;
		this.y = y;
		this.tf = tf;
		new Thread(()->new Audio("audio/explode.wav").play()).start();
	}
	public void paint(Graphics g) {
		Color c = g.getColor();
		g.setColor(Color.RED);
		g.fillRect(x, y, 10*step, 10*step);
		step++;
		if(step>=10) {
			tf.explodes.remove(this);
		}
		g.setColor(c);
	}

}
